package com.bw.workdemo.mapper;


import com.bw.workdemo.pojo.TbRegister;
import com.bw.workdemo.pojo.TbRegisterExample;
import com.bw.workdemo.pojo.entity.SexEntity;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;
@Mapper
public interface TbRegisterMapper {
    int countByExample(TbRegisterExample example);

    int deleteByExample(TbRegisterExample example);

    int deleteByPrimaryKey(Long id);

    int insert(TbRegister record);

    int insertSelective(TbRegister record);

    List<TbRegister> selectByExample(TbRegisterExample example);

    TbRegister selectByPrimaryKey(Long id);

    int updateByExampleSelective(@Param("record") TbRegister record, @Param("example") TbRegisterExample example);

    int updateByExample(@Param("record") TbRegister record, @Param("example") TbRegisterExample example);

    int updateByPrimaryKeySelective(TbRegister record);

    int updateByPrimaryKey(TbRegister record);

   List<SexEntity> selectBySex();


    @Select("SELECT\r\n" +
            "count(*)\r\n" +
            "FROM\r\n" +
            "tb_register\r\n" +
            " where\r\n" +
            " role = '爱心人士' \r\n" +
            " and \r\n" +
            " createdate = #{date}")
    int selectByDateL(String s);



    @Select("SELECT\r\n" +
            "count(*)\r\n" +
            "FROM\r\n" +
            "tb_register\r\n" +
            " where\r\n" +
            " role = '贫困户' \r\n" +
            " and \r\n" +
            " createdate = #{date}")
    int selectByDateP(String s);


    @Select("SELECT\r\n" +
            "count(*)\r\n" +
            "FROM\r\n" +
            "tb_register\r\n" +
            " where\r\n" +
            " role = '管理员' \r\n" +
            " and \r\n" +
            " createdate = #{date}")
    int selectByDateA(String s);

    @Select("select * from tb_register")
    List<TbRegister> selectList();
}